<#include "/layout/layout.ftl">
<#import "/layout/macro.ftl" as macro>
<#assign css>
<style>
</style>
</#assign>
<#assign js>
<script>
	function del(id) {
		layer.confirm('确定取消该提现申请?', {icon: 3, title: '提示'}, function (index) {
			$.ajax({
				type: "POST",
				dataType: "json",
				url: "/agentDrawApply/delete/" + id,
				success: function (res) {
				    if(res.code=='0'){
                        layer.msg(res.message, {time: 2000}, function () {
                            location.reload();
                        });
					}else{
                        layer.msg("取消失败", {time: 2000});
					}


				}
			});
		});
	}

	//tableId,queryId,conditionContainer
	//var userTable;
	var winId="userWin";
	$(function() {
		//init table and fill data
		//userTable = new CommonTable("user_table", "user_list", "searchDiv");

		//button event
		$('button[data-btn-type]').click(function() {
			var action = $(this).attr('data-btn-type');
			var rowId="ceshi";
			switch (action) {
				case 'add':
					modals.openWin({
						winId:winId,
						title:'新增分站提现申请',
						width:'900px',
						url:"/agentDrawApply/edit/ceshi"
					});
					break;
				case 'edit':
					if(!rowId){
						modals.info('请选择要编辑的行');
						return false;
					}
					modals.openWin({
						winId:winId,
						title:'编辑分站提现申请【'+userTable.getSelectedRowData().name+'】',
						width:'900px',
						url:"/agentDrawApply/edit/"+rowId,
					});
					break;
				case 'delete':
					if(!rowId){
						modals.info('请选择要删除的行');
						return false;
					}
					modals.confirm("是否要删除该行数据？",function(){
						ajaxPost(basePath+"/agentDrawApply/delete/"+rowId,null,function(data){
							if(data.success){
								//modals.correct("已删除该数据");
								userTable.reloadRowData();
							}else{
								modals.error("分站提现申请数据被引用，不可删除！");
							}
						});
					})
					break;
			}

		});
		//form_init();
	});
</script>
</#assign>
<@layout title="分站提现申请管理" active="agentDrawApply">
<!-- Content Header (Page header) -->

<!-- Main content -->
<section class="content">

    <div class="row">

        <div class="col-md-3 col-sm-6 col-xs-12">
            <div class="info-box">
                <span class="info-box-icon bg-green"><i class="fa-usd"></i></span>

                <div class="info-box-content">
                    <span class="info-box-text">账户余额</span>
                    <span class="info-box-number" style="font-size: 3em">${(balance?string('0.00'))!}</span>
                </div>
            </div>
        </div>


    </div>

	<!-- Default box -->
	<div class="box box-primary">
		<div class="box-header">

            <form class="form-horizontal form-edit" method="post" action="/agentDrawApply/index" id="form">

                <div class="form-group">

                    <div class="col-sm-2">
						<select id="status" name="status" class="form-control">
							<option value="">请选择</option>
							<option value="1" <#if status?? && status == '1'>selected</#if>>申请中</option>
							<option value="2" <#if status?? && status == '2'>selected</#if>>提现成功</option>
							<option value="3" <#if status?? && status == '3'>selected</#if>>提现失败</option>
							<#--<option value="4">已取消</option>-->

						</select>
                    </div>


                    <div class="btn-group">
                        <button type="submit" class="btn btn-primary" data-btn-type="search">查询</button>
                        <button type="button" class="btn btn-default" data-btn-type="reset" onclick="javascript:$('#form')[0].reset();">重置</button>
                    </div>
                </div>
            </form>

        <@shiro.hasPermission name="system:agentDrawApply:add">
			<a class="btn btn-sm btn-success" href="/agentDrawApply/add">提现</a>
        </@shiro.hasPermission>
		</div>
		<div class="box-body">
			<table class="table table-striped">
				<tr>
					<th></th>
                    <th>银行卡号</th>
                    <th>户名</th>
                    <th>开户银行</th>
					<th>申请提现金额</th>
					<th>手续费</th>
					<th>提现申请状态</th>
					<th>申请时间</th>
					<th>失败原因</th>
					<th>操作</th>
				</tr>
                <#list pageInfo.list as item>
                <tr>
					<td >${item.id!}</td>
                    <td >${item.account!}</td>
                    <td >${item.accountName!}</td>
                    <td >${item.openBank!}</td>
					<td >${(item.amount?string('0.00'))!}</td>
					<td >${(item.fee?string('0.00'))!}</td>

					<td >
						<#if item.status ==1>
							申请中
						</#if>
						<#if item.status ==2>
							提现成功
						</#if>
						<#if item.status ==3>
							提现失败
						</#if>
						<#if item.status ==4>
							已取消
						</#if>
					</td>
					<td >${item.createAt?string('yyyy-MM-dd HH:mm:ss')}</td>
					<td >${item.reason!}</td>
					<td>
					<@shiro.hasPermission name="system:agentDrawApply:detail">
                        <a class="btn btn-sm btn-success" href="/agentDrawApply/detail/${item.id}" data-btn-type="detail">详情</a>
                    </@shiro.hasPermission>
					<#--<#if item.status ==1>-->
						<#--<@shiro.hasPermission name="system:agentDrawApply:delete">-->
							<#--<button class="btn btn-sm btn-danger" onclick="del('${item.id}')">取消</button>-->
						<#--</@shiro.hasPermission>-->

					<#--</#if>-->

					</td>
				</tr>
                </#list>
			</table>
		</div>
		<!-- /.box-body -->
		<div class="box-footer clearfix">
            <@macro.page pageInfo=pageInfo url="/agentDrawApply/index?status=${status!}" />
		</div>
	</div>
	<!-- /.box -->

</section>
<!-- /.content -->
</@layout>
